import { ref } from "vue";
import { checkPassword } from "@/utils/index";
export function usePassword(formRef) {
    const fields = ref({
        password: "",
    });
    const rules = {
        password: [{ required: true, validator: checkPassword, trigger: "change" }],
    };
    /**
     * 点击确定按钮，校验表单
     * @returns
     */
    const useBeforeChange = () => {
        return new Promise((resolve, reject) => {
            formRef.value
                .validate()
                .then((res) => {
                console.log(11);
            })
                .catch(() => {
                reject();
            });
        });
    };
    return {
        fields,
        rules,
        useBeforeChange,
    };
}
